<style lang="less">
	/*@import './international.less';*/
</style>

<template>
	<div>
		<common-page v-bind="menuPage">
			<template slot="modal">
				<Form :model="menuPage.detailData" :label-width="80">
					<FormItem label="uuid">
						<Input v-model="menuPage.detailData.uuid"></Input>
					</FormItem>
					<FormItem label="日志等级">
						<Input v-model="menuPage.detailData.level"></Input>
					</FormItem>
					<FormItem label="日期">
						<Input v-model="menuPage.detailData.date"></Input>
					</FormItem>
					<FormItem label="ip">
						<Input v-model="menuPage.detailData.ip"></Input>
					</FormItem>
					<FormItem label="线程名">
						<Input v-model="menuPage.detailData.threadName"></Input>
					</FormItem>
					<FormItem label="日志message">
						<Input v-model="menuPage.detailData.message" type="textarea" :rows="10"></Input>
					</FormItem>
				</Form>
			</template>
		</common-page>
	</div>
</template>

<script>

    import commonPage from '@/views/common/common-page.vue';
    import util from '@/libs/util';
    import autoSelect from '@/views/common/autoSelect.vue';
    import _ from 'lodash';

    // 默认界面查询条件
    let pageParams = Object.assign({}, util.queryParams, { // 额外的参数,比如条件的默认值
        sortName: "date",
        sortOrder: "desc",
        levels: []
    });
    export default {
        name: 'log-page',
        components: {
            commonPage,
            autoSelect
        },
        props: {},
        data () {
            return {
                menuPage: {
                    exportCurrentPageConfiguration(cnf){
                        let commonPage = cnf.commonPage;
                        let exportColumnIndexs = [8]; // 日志数据
//                        let data = _.filter(commonPage.list.table.data, function (value, index, arr) {
//							return _.indexOf(exportColumnIndexs, index) !== -1;
//                        });
                        let data = commonPage.list.table.data;
                        let columns = [
                            {title: '日志message', key: 'message', width: 400}
                        ];
                        return {
                            data: data,
                            columns: columns,
                            filename: "日志数据"
                        };
                    },
                    toolbar: {
                        menuSn: "log",
                        buttons: []
                    },
                    list: {
                        table: {
                            columns: [{type: 'selection', width: 50, align: 'center'},
                                {type: 'index', width: 60, align: 'center'},
                                {title: 'ID', key: 'id', sortable: "custom"},
                                {title: 'uuid', key: 'uuid'},
                                {title: '日志等级', key: 'level'},
                                {title: '日期', key: 'date', width: 200},
                                {title: '主机IP', key: 'ip'},
                                {title: '线程名', key: 'threadName'},
                                {title: '日志message', key: 'message', width: 400}
                            ],
                            data: []
                        },
                        url: "log/list",
                        queryParams: pageParams

                    },
                    searchbar: {
                        queryParams: pageParams,
                        inputs: [{
                            text: "uuid",
                            sn: "uuid",
                            style: {
                                width: "200px"
                            }
                        }, {
                            text: "日期起",
                            sn: "dateStart",
                            type: "datetime",
                            format: "yyyy-MM-dd HH:mm:ss",
                            style: {
                                width: "100px"
                            }
                        }, {
                            text: "日期止",
                            sn: "dateEnd",
                            type: "datetime",
                            format: "yyyy-MM-dd HH:mm:ss",
                            style: {
                                width: "100px"
                            }
                        }, {
                            text: "日志等级",
                            sn: "levels",
                            style: {
                                width: "200px"
                            },
                            type: "select",
                            options: [{
                                text: "TRACE",
                                value: "TRACE"
                            }, {
                                text: "DEBUG",
                                value: "DEBUG"
                            }, {
                                text: "INFO",
                                value: "INFO"
                            }, {
                                text: "WARN",
                                value: "WARN"
                            }, {
                                text: "ERROR",
                                value: "ERROR"
                            }],
                            multiple: true
                        }, {
                            text: "主机IP",
                            sn: "ip",
                            style: {
                                width: "200px"
                            }
                        }, {
                            text: "日志message",
                            sn: "message",
                            style: {
                                width: "200px"
                            }
                        }]
                    },
                    pageParams: pageParams,
                    detailData: {
                        uuid: "",
                        level: "",
                        ip: "",
                        message: "",
                        date: "",
                        id: "",
                        threadName: ""
                    }
                }
            };
        },
        methods: {},
        created () {
        },
        mounted() {
        }
    };
</script>
